<div>
  <div style="padding-top: 10px; padding-left: 10px;">
    <h1>Listing bugs</h1>
    <span class="page_action"><%= link_to 'Create a new bug', new_bug_path %></span>
    <span class="page_action"><%= link_to 'Import bugs', :controller => "bugs", :action => "import" %></span>
  </div>

  <div style="padding: 10px;">
    <% form_tag(bugs_path, :method => :get) do %>
        <%= label_tag(:developer_to_filter, "Developer:") %>
        <%= text_field_tag(:developer_to_filter, session[:developer_to_filter]) %>
        <%= label_tag(:status_to_filter, "Status:") %>
        <%= text_field_tag(:status_to_filter, session[:status_to_filter]) %>

        <%= check_box_tag(:closed_ones_too, 'checked', session[:closed_ones_too]) %>
        <%= label_tag(:closed_ones_too, "Show closed bugs too") %>

        <%= submit_tag("Filter") %>
        <%= submit_tag "Clear Filter", :onclick => "$('developer_to_filter').value='';$('status_to_filter').value='';$('closed_ones_too').checked=false;" %>
    <% end %>
  </div>

</div>

<div id="container" style="width: 700px;">
  <div style="float:left;width:300px;padding:5px;">
    <span class="heading">Defects <img src="images/icons/onebit_bug.png" alt=""/></span>
    <% defects = @bugs.select { |b| b.defect? } %>
    <%= render :partial => 'singlebug', :collection => defects %>
  </div>

  <div style="float:right; width:300px;padding:5px;">
    <span class="heading">Change Requests <img src="images/icons/onebit_bulb.png" alt=""/> </span>
    <% enhancements = @bugs.select { |b| !b.defect? }
       with_release = enhancements.select { |b| b.release }
       with_release.sort! do |a, b|
          a.release.release_number <=> b.release.release_number
       end
       without_release = enhancements.select { |b| !b.release }
       enhancements = with_release.concat(without_release)
    %>
    <%= render :partial => 'singlebug', :collection => enhancements %>
  </div>

</div>


<div style="clear:both; padding-top: 10px; padding-left: 10px;">
  <span class="page_action"><%= link_to 'Create a new bug', new_bug_path %></span>
  <span class="page_action"><%= link_to 'Import bugs', :controller => "bugs", :action => "import" %></span>

</div>


<br/>
<br/>
<br/>


